package com.iss.okair.controller.assets;

import com.iss.common.Message;
import com.iss.okair.db.entity.AssetsPermanent;
import com.iss.okair.db.model.AssetsPermanentModel;
import com.iss.okair.service.assets.AssetsPermanentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/logic/assets/permanent")
public class AssetsPermanentController {

    @Autowired
    private AssetsPermanentService service;

    @RequestMapping("/list")
    public List<AssetsPermanent> find(AssetsPermanentModel model){
        return service.find(model);
    }

    @RequestMapping("/save")
    public Message save(AssetsPermanent assets){
        Message msg = new Message();
        if(service.save(assets)){
            msg.setError(false);
            msg.setMsg("保存成功");
        }
        else{
            msg.setError(true);
            msg.setMsg("保存失败");
        }
        return msg;
    }
}
